Skip to content

fix: stop matching instrumental tracks against unrelated songs (#40)#47

Merged
Felitendo merged 1 commit intomasterfrom
fix/issue-40-instrumental-tracks
May 6, 2026
Merged

fix: stop matching instrumental tracks against unrelated songs (#40)#47
Felitendo merged 1 commit intomasterfrom
fix/issue-40-instrumental-tracks

Conversation

@Felitendo
Copy link
Copy Markdown
Owner

Summary

Fixes #40 — instrumental/interlude tracks being assigned lyrics from a completely different song that happens to share a similar title.

Three layered changes in LyricsProvider.cs, plus a user-facing toggle:

  • Honor LRCLIB's instrumental: true flag. It was already being deserialized in LyricsSearchResponse but never read. GetRemoteLyrics now early-returns empty when the flag is set, so LRCLIB-known instrumentals stop producing matches.
  • Validate every match against the request. New IsAcceptableMatch helper rejects results whose artist doesn't appear (case-insensitive substring against any token from SplitArtists) or whose duration differs from the local file by more than the configured tolerance. Applied in both GetExactMatch (single response from /api/get) and SearchLrclib (per-item filter on /api/search results).
  • Drop the dangerous track-name-only fuzzy fallback when artist info exists. Previously, if artist+album and artist-only both failed, the code would fall back to SearchLrclib(trackName, null, null) — which is exactly how "Faded (Interlude)" by Alan Walker ended up matching a "Faded" by some other artist. The fallback is preserved only when no artist info is available at all.

New setting

  • Filter matches by song length (checkbox, default on) — turn the duration filter off entirely if needed.
  • Duration tolerance (seconds) (default 15) — only used when the filter is on. Lower for stricter matching, higher for more forgiving (long trailing silence, remasters, vinyl rips).

Existing users get the filter on by default after update — the bug is fixed out-of-the-box without any settings change.

Test plan

  • dotnet build clean (0 warnings, 0 errors)
  • Plugin loads in Jellyfin (verified in local container)
  • Manual reproduction: track titled "Faded (Interlude)" by Alan Walker (~30s) no longer gets matched
  • Regression check: legitimate songs (full-length "Faded" by Alan Walker) still match
  • Tolerance edge cases: a track with ~10s trailing silence still matches at default 15s tolerance
  • Filter off: matches behave like before the fix (artist check still applies)

Notes for reviewers

  • No new HTTP calls or external dependencies — purely client-side filtering of existing LRCLIB responses.
  • New debug log lines (Rejected LRCLIB match {Id}: artist mismatch … / … duration mismatch … / Skipping LRCLIB entry … flagged as instrumental) make it easy to confirm the fix is working in the wild.
  • README has a new "How match filtering works" section explaining both the toggle and the tolerance value, plus two new troubleshooting entries.

Honor LRCLIB's instrumental flag, validate every match against the
requested duration and artist, and drop the track-name-only fuzzy
fallback when artist info is available. Adds a configurable
duration-tolerance filter (default on, ±15s) with a UI toggle so users
can disable or tune it.
@Felitendo Felitendo merged commit 82c40a3 into master May 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Instrumental tracks are mistakenly being assigned lyrics

1 participant